package com.samba.entites;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "TABLE_ADRESSE")
@SequenceGenerator(name = "SeqAdresse" , sequenceName= "adresse_seq")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Adresse  implements Serializable {
	
	@Id
	@GeneratedValue(strategy =  GenerationType.SEQUENCE, generator = "SeqAdresse")
	private long adresseid;
	
	private BigDecimal codepostal;
	private String departement;
	private BigDecimal numero;
	private String pays;
	private String rue;
	private String ville;
	

	
	@OneToMany(mappedBy = "adresseFk")
	private Set<Utilisateur> ensembleUtilisateurs;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public Adresse()
	{
		super();
	}

	public long getAdresseid() {
		return adresseid;
	}

	public void setAdresseid(long adresseid) {
		this.adresseid = adresseid;
	}

	public BigDecimal getCodepostal() {
		return codepostal;
	}

	public void setCodepostal(BigDecimal codepostal) {
		this.codepostal = codepostal;
	}

	public String getDepartement() {
		return departement;
	}

	public void setDepartement(String departement) {
		this.departement = departement;
	}

	public BigDecimal getNumero() {
		return numero;
	}

	public void setNumero(BigDecimal numero) {
		this.numero = numero;
	}

	public String getPays() {
		return pays;
	}

	public void setPays(String pays) {
		this.pays = pays;
	}

	public String getRue() {
		return rue;
	}

	public void setRue(String rue) {
		this.rue = rue;
	}

	public String getVille() {
		return ville;
	}

	public void setVille(String ville) {
		this.ville = ville;
	}

	public Set<Utilisateur> getEnsembleUtilisateurs() {
		return ensembleUtilisateurs;
	}

	public void setEnsembleUtilisateurs(Set<Utilisateur> ensembleUtilisateurs) {
		this.ensembleUtilisateurs = ensembleUtilisateurs;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (adresseid ^ (adresseid >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Adresse other = (Adresse) obj;
		if (adresseid != other.adresseid)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Adresse [adresseid=" + adresseid + "]";
	}
}
